9cc2fc21844fce92c63272136f25940e226bae79,src/main/java/br/net/fabiozumbi12/RedProtect/RPContainer.java,RPContainer,canBreak,#Player#Block#,67
Before Change
@SuppressWarnings("deprecation")
public boolean canBreak(Player p, Block b){
if (!RPConfig.getBool("private.use")){
return true;
}
Region reg = RedProtect.rm.getTopRegion(b.getLocation());
if (reg == null && !RPConfig.getBool("private.allow-outside")){
return true;
}
int x = b.getX();
int y = b.getY();
int z = b.getZ();
World w = p.getWorld();
if (b.getState() instanceof Sign && !validateBreakSign(b, p)){
return false;
}
String signbtype;
if (RPConfig.getBool("private.allowed-blocks-use-ids")){
signbtype = Integer.toString(b.getTypeId());
} else {
signbtype = b.getType().name();
}
if (RPConfig.getStringList("private.allowed-blocks").contains(signbtype)){
for (int sx = -1; sx <= 1; sx++){
for (int sy = -1; sy <= 1; sy++){
for (int sz = -1; sz <= 1; sz++){
Block bs = w.getBlockAt(x+sx, y+sy, z+sz);
if (bs.getState() instanceof Sign && !validateBreakSign(bs, p) && getBlockRelative(bs).getType().equals(b.getType())){
return false;
}
String blocktype2;
if (RPConfig.getBool("private.allowed-blocks-use-ids")){
blocktype2 = Integer.toString(b.getTypeId());
} else {
blocktype2 = b.getType().name();
}
int x2 = bs.getX();
int y2 = bs.getY();
int z2 = bs.getZ();
if (RPConfig.getStringList("private.allowed-blocks").contains(blocktype2)){
for (int ux = -1; ux <= 1; ux++){
for (int uy = -1; uy <= 1; uy++){
for (int uz = -1; uz <= 1; uz++){
Block bu = w.getBlockAt(x2+ux, y2+uy, z2+uz);
if (bu.getState() instanceof Sign && !validateBreakSign(bu, p) && getBlockRelative(bu).getType().equals(b.getType())){
return false;
}
}
}
After Change
@SuppressWarnings("deprecation")
public boolean canBreak(Player p, Block b){
if (!RPConfig.getBool("private.use") || p.hasPermission("redprotect.bypass")){
return true;
}
Region reg = RedProtect.rm.getTopRegion(b.getLocation());
if (reg == null && !RPConfig.getBool("private.allow-outside")){
return true;
}
int x = b.getX();
int y = b.getY();
int z = b.getZ();
World w = p.getWorld();
boolean deny = true;
if (b.getState() instanceof Sign && (validatePrivateSign(b) || validateMoreSign(b))){
deny = false;
if (validateBreakSign(b, p)){
return true;
}
}
String signbtype;
if (RPConfig.getBool("private.allowed-blocks-use-ids")){
signbtype = Integer.toString(b.getTypeId());
} else {
signbtype = b.getType().name();
}
if (RPConfig.getStringList("private.allowed-blocks").contains(signbtype)){
for (int sx = -1; sx <= 1; sx++){
for (int sy = -1; sy <= 1; sy++){
for (int sz = -1; sz <= 1; sz++){
Block bs = w.getBlockAt(x+sx, y+sy, z+sz);
if (bs.getState() instanceof Sign && (validatePrivateSign(bs) || validateMoreSign(bs))){
deny = false;
if (validateBreakSign(bs, p)){
return true;
}
}
String blocktype2;
if (RPConfig.getBool("private.allowed-blocks-use-ids")){
blocktype2 = Integer.toString(b.getTypeId());
} else {
blocktype2 = b.getType().name();
}
int x2 = bs.getX();
int y2 = bs.getY();
int z2 = bs.getZ();
if (RPConfig.getStringList("private.allowed-blocks").contains(blocktype2)){
for (int ux = -1; ux <= 1; ux++){
for (int uy = -1; uy <= 1; uy++){
for (int uz = -1; uz <= 1; uz++){
Block bu = w.getBlockAt(x2+ux, y2+uy, z2+uz);
if (bu.getState() instanceof Sign && (validatePrivateSign(bu) || validateMoreSign(bu))){
deny = false;
if (validateBreakSign(bu, p)){
return true;
}
}